import { defineStore } from 'pinia'
import { ref, reactive } from 'vue'
import { RoomTypeEnum } from '@/enums'

export const useGlobalStorage = defineStore('globalStorage', () => {
  // 全局变量 显示消息列表
  const visibleMessage = ref(false)
  //切换显示消息显示
  const toggleVisibleMessage = () => {
    visibleMessage.value = !visibleMessage.value
  }
  //当前会话
  const currentSession = reactive<{ roomId: number; type: RoomTypeEnum }>({
    roomId: 1,
    type: RoomTypeEnum.Group,
  })

  return { visibleMessage, toggleVisibleMessage, currentSession }
})
